<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/base/jsp/include.jsp"%>
<style>
</style>
<script type="text/javascript">
	var id = "${id}";
	var parent = "${parent}";
	var level = "${level}";
	
	var submitForm = function($dialog, $grid, $pjq) {
		if ($('form').form('Validate')) {
			var url = sy.contextPath + '/social/cateSave.do';
			var obj = sy.serializeObject($('form'));
			if(parent!=""){
				obj.level = level;
				obj.parentCode = parent;
			}
			$.post(url,obj , function(result) {
				if (result.code == 0) {
					$grid.treegrid('reload');
					$dialog.dialog('destroy');
				} else {
					$pjq.messager.alert('提示', '操作失败', 'error');
				}
			}, 'json');
		}
	};

	$(function() {
		if (id != '') {
			$.post(sy.contextPath + '/social/findCateById.do', {
				id : id
			}, function(result) {
				if (result) {
					$('form').form('load', result);
					$('#logo').setFileId(result.logo,false,true,true,"300x300");
				}
			}, 'json');
			$('#code').textbox({novalidate:true,disabled:true});
		}
	});
</script>
</head>
<body>
	<form id="form" method="post">
        <input name="id" type="hidden" />
        <div style="padding:15px;font-size: 12px">
            <table style="table-layout:fixed;" border="0" cellspacing="0" class="formtable">
            	<tr>
                    <th style="width:100px;">编号：</th>
                    <td>   
                    	 <input id="code" name="c1ode" class="easyui-textbox" data-options="required:true,validType:['number','length[3,3]','unique[\'/social/checkCateCode.do?parent=${parent}\']']" prompt="请输入编号" missingMessage="请输入编号" style="width: 200px;"/>
                    </td>
                </tr>
            	<tr>
                    <th style="width:100px;">名称：</th>
                    <td>
                    	 <input id="title" name="title" class="easyui-textbox" data-options="required:true,validType:['length[0,25]']" missingMessage="请输入名称" style="width: 200px;" prompt="请输入名称"/>
                    </td>
                </tr>
                <tr>
                    <th style="width:100px;">图片：</th>
                    <td>
                    	<input id="logo" multi="false" type="file" showImage="true" showBtn='true' bestSize='300*300' fileType="*.jpg;*.png" fileSize="200KB" buttonText="上传图片"/>
                    	<label style="color: red;">*</label>
                    	<label>建议尺寸：宽度300，高度300，格式JPG,PNG</label>
                    </td>
                </tr>
                <tr>
                    <th style="width:100px;">排序(倒序)：</th>
                    <td>   
                    	 <input id="sortOrder" name="sortOrder" class="easyui-numberbox" data-options="required:true,min:0,max:9999" value="" missingMessage="请输入排序号" prompt="请输入排序号" style="width:90%;"/>
                    </td>
                </tr>
            </table>
        </div>
	</form>
</body>
</html>